//WdgTitle.cpp
/*    widgetpp - A simple C++ wrapper of DISLIN graphic library               */
/*                                                                            */
/*    Copyright (C) 2012  Mirko Cambi (email: mirko.cambi@gmail.com)          */
/*                                                                            */
/*    This program is free software: you can redistribute it and/or modify    */
/*    it under the terms of the GNU General Public License as published by    */
/*    the Free Software Foundation, either version 3 of the License, or       */
/*    (at your option) any later version.                                     */
/*                                                                            */
/*    This program is distributed in the hope that it will be useful,         */
/*    but WITHOUT ANY WARRANTY; without even the implied warranty of          */
/*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           */
/*    GNU General Public License for more details.                            */
/*                                                                            */
/*    You should have received a copy of the GNU General Public License       */
/*    along with this program.  If not, see <http://www.gnu.org/licenses/>.   */

#include "WdgTitle.hpp"
#include "WdgColors.hpp"
#include "dislin.h"

using namespace wdgpp;

WdgTitle::WdgTitle(
): _line0(""), _line1(""), _line2(""), _line3(""), 
   _color(colors::fore), _height(50)
{
}

void WdgTitle::set_line(unsigned int line, const std::string &text)
{
   switch(line) {
   case 0: 
      _line0 = text;
      break;
   case 1: 
      _line1 = text;
      break;
   case 2: 
      _line2 = text;
      break;
   case 3: 
      _line3 = text;
      break;
   default:
      ;
   }
}

void WdgTitle::set_color(unsigned int color)
{
   _color = color;
}
void WdgTitle::set_height(unsigned int height)
{
   _height = height;
}

void WdgTitle::draw() const
{
   titlin(_line0.c_str(), 1);
   titlin(_line1.c_str(), 2);
   titlin(_line2.c_str(), 3);
   titlin(_line3.c_str(), 4);
   
   ::set_color(_color);
   height(_height);
   title();
}

